export default{
    inject: ['layout'],
    data(){
        return{
            pageInit:false,
            loading:false
        }
    },
    created(){
        this.layout.load();
    },
    mounted(){
        this.layout.unload();
        this.pageInit = true;
    },
    destroyed(){
        this.layout.unload();
    },
    watch:{
        loading(newValue,oldValue){

            //console.log('loading')
            if( !this.pageInit )
                return;
            if( newValue ){
                this.layout.load();
            }else{
                this.layout.unload();
            }
        }
    },
    methods:{
        showInfo(text){
            this.$message({
                showClose: false,
                message: text,
                type: 'info',
                customClass:'rsui-tips',
                duration:2000
            });
        },
        showError(text){
            this.$message({
                showClose: false,
                message: text,
                type: 'error',
                customClass:'rsui-tips',
                duration:2000
            });
        }
    }
}